﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace The_Last_Knights.GUI
{
    public class TabControl: Groupbox
    {
        #region Attributes
        protected PushButton _button;
        protected bool _isFocus;
        protected Groupbox _groupbox;
#endregion

        #region Properties
        public PushButton Button
        {
            get { return _button; }
            set { _button = value; }
        }
        
        public Groupbox Groupbox
        {
            get { return _groupbox; }
        }

        public bool IsFocus
        {
            get { return _isFocus; }
            set
            {
                _isFocus = value;
            }
        }
#endregion

        public TabControl(Game game, string ID, Vector2 pos, Vector2 size, Texture2D background, PushButton button, Groupbox groupbox) 
            : base(game, ID, pos, size, background)
        {
            _button = button;
            _groupbox = groupbox;
            _isFocus = false;
        }

        public override void Update(GameTime gameTime)
        {
            _button.Update(gameTime);                                    
            try
            {
                if (_isFocus)
                    _groupbox.Update(gameTime);    
            }            
            catch(Exception){}
            base.Update(gameTime);
        }

        public override void Draw(GameTime gameTime)
        {
            base.Draw(gameTime);            
            try
            {
                if (_isFocus)
                    _groupbox.Draw(gameTime);    
            }            
            catch(Exception) {}
            _button.Draw(gameTime);    
        }
    }
}
